package racer.server;

import java.util.ArrayList;

public class Race {

	private int raceid;
	private String gametype;
	private String mapName;
	private int maxPlayers;
	private int numPlayers;
	private ArrayList<Integer> players;
	
	public Race(int raceid, String mapName, String gametype, int maxPlayers) {
		this.raceid = raceid;
		this.mapName = mapName;
		this.gametype = gametype;
		this.maxPlayers = maxPlayers;
		numPlayers = 0;
		players = new ArrayList<Integer>(maxPlayers);
	}
	public Race(int raceid, String mapName, String gametype, int numPlayers, int maxPlayers) {
		this.raceid = raceid;
		this.mapName = mapName;
		this.gametype = gametype;
		this.maxPlayers = maxPlayers;
		this.numPlayers = numPlayers;
		players = new ArrayList<Integer>(maxPlayers);
	}
	
	public void addPlayer(int playerid) {
		numPlayers++;
		players.add(playerid);
	}
	public void removePlayer(int playerid) {
		numPlayers--;
		players.remove(new Integer(playerid));
	}
	
	public int getMaxPlayers() {
		return this.maxPlayers;
	}
	public int getNumberOfPlayers() {
		return numPlayers;
	}
	public ArrayList<Integer> getPlayers() {
		return players;
	}
	public String getMapName() {
		return this.mapName;
	}
	public String getGametype() {
		return gametype;
	}
	public int getNumPlayers() {
		return numPlayers;
	}
	public int getRaceid() {
		return raceid;
	}
	
}
